package com.ey12.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import com.ey12.db.dao.GmCserverDAO;
import com.ey12.db.domain.GmCp;
import com.ey12.db.domain.GmCserver;
import com.ey12.db.domain.GmGameStore;
import com.ey12.db.domain.GmManager;
import com.ey12.db.domain.GmOrder;
import com.ey12.utils.MD5Util;

public class GmCserverService {
	private GmCserverDAO gmCserverDAO;

	public void setGmCserverDAO(GmCserverDAO gmCserverDAO) {
		this.gmCserverDAO = gmCserverDAO;
	}
	public GmCserverDAO getGmCserverDAO() {
		return gmCserverDAO;
	}
	public void deleteAllGmCserver(List list){
		System.out.println("list.size()="+list.size());
		for (int i = 0; i < list.size(); i++) {
			GmCserver gm = (GmCserver)list.get(i);
			gmCserverDAO.delete(gm);
		}
	}
	public void deleteGmCserver(GmCserver g){
		gmCserverDAO.delete(g);
	}
	public void updateGmCserve(GmCserver gm) {
		gmCserverDAO.saveOrUpdate(gm);
	}
	
//	public List getGameDetialData(String gameName,String cserverName,String serverType) {
//		List games = gmCserverDAO.findGameDetialData(gameName,cserverName,serverType);
//		if (games.size() > 0) {
//			GmCserver game = (GmCserver) games.get(0);
//			System.out.println("game.getGmGameStores()="+game.getGmGameStores().size());
//			return switchCserverValues(game.getGmGameStores());
//		}
//		return null;
//	}
//	private List switchCserverValues(Set set) {
//		List result = new ArrayList();
//		if (set.size() > 0) {
//			for (int i = 0; i < set.size(); i++) {
//				GmGameStore gm = (GmGameStore) ((ArrayList) set).get(i);
//				if(gm.getIsDeposit()==2) {
//					gm.setGoodState("��");
//				}
//				else{
//					gm.setGoodState("");
//				}
//				// 1��2��
//				if(gm.getIsQuick()==2) {
//					gm.setGoodState(gm.getGoodState()+"��");
//				}
//				result.add(gm);
//				gm = null;
//			}
//		}
//
//		return result;
//	}
	public List getallGame(){
		List list = gmCserverDAO.findAll();
		if(list.size()>0){
			return list;
		}
		return null;
	}
	public List getSellViewSecondCbx(String gameName){
		List list = gmCserverDAO.findSellViewSecondCbx(gameName);
		if(list.size()>0){
			return list;
		}
		return null;
	}
}
